<?php
$PWD=dirname(__FILE__);
$valgrind="valgrind --leak-check=full";
$vxp="$PWD/../../vxp";
$test_file="$PWD/pathx1-tests.xml";
$tests=simplexml_load_file($test_file);

$pass=0;
$fail=0;
$count=0;

foreach($tests->test as $test)
{
    $count++;
    $arg=(string)$test['value'];

    $result=0;
    $output=Array();
    exec("$valgrind $vxp"." ".escapeshellarg($arg)." 2>/dev/null",$output,$result);

    if ($result==0)
    {
        $pass++;
        print "[PASSED] $arg\n";
    }
    else
    {
        print "[FAILED] $arg\n";
        $fail++;
    }

}

print "--------------------\n";
print "PASSED: $pass/$count (".number_format(($pass/(float)$count)*100,0)."%)\n";
print "FAILED: $fail/$count (".number_format(($fail/(float)$count)*100,0)."%)\n";
